package com.tong.ipprint.interceptor;

import com.tong.ipprint.service.IpPrintService;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 定义拦截器
 * @Author: tong
 * @Date: 2024/07/28/17:03
 * @Description:
 */
public class IpPrintInterceptor implements HandlerInterceptor {
    @Resource
    private IpPrintService ipPrintService;
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        // 调用ip统计业务
        ipPrintService.print();
        return true;
    }
}
